﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using Fx.Mvc.Security.Entities;

namespace Fx.Mvc.Security.Maps
{
    public class LogMap : ClassMap<Log>
    {
        public LogMap()
        {
            Schema("admin");
            Table("Logs");
            Id(x => x.Id).GeneratedBy.Identity();
            Map(x => x.Action).Not.Nullable();
            Map(x => x.Exception).Not.Nullable().MaxLength();
            Map(x => x.StackTrace).Not.Nullable().MaxLength();
            Map(x => x.Data).Not.Nullable().MaxLength();
            Map(x => x.Creator).Not.Nullable();
            Map(x => x.EntryDate).Not.Nullable();
        }
    }

    public static class PropertyPartExtensions
    {
        public static PropertyPart MaxLength(this PropertyPart part)
        {
            return part.Length(8000);
        }
    }
}
